Ubuntu 10.04
Sponsored Link

Install NIS Server
2010/07/22
  Configure NIS server in order to share users' accounts.

[1] Install NIS
root@master:~#
aptitude -y install nis portmap


Preconfiguring packages ...

# input domain name


root@master:~#
update-rc.d portmap defaults 10
# set before NIS

update-rc.d: warning: /etc/init.d/portmap missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
# it's no ploblem above. it may be bugs

  Adding system startup for /etc/init.d/portmap ...
/etc/rc0.d/K19portmap -> ../init.d/portmap

/etc/rc1.d/K19portmap -> ../init.d/portmap

/etc/rc6.d/K19portmap -> ../init.d/portmap

/etc/rc2.d/S19portmap -> ../init.d/portmap

/etc/rc3.d/S19portmap -> ../init.d/portmap

/etc/rc4.d/S19portmap -> ../init.d/portmap

/etc/rc5.d/S19portmap -> ../init.d/portmap

[2] Configure NIS Server
root@master:~#
vi /etc/default/nis


# line 6: change (set NIS master server)

NISSERVER=
master


root@master:~#
vi /etc/ypserv.securenets


# This line gives access to everybody. PLEASE ADJUST!
# make it comment

#
0.0.0.0 0.0.0.0

# add at the bottom: IP address you allow

255.255.255.0
10.0.0.0


root@master:~#
vi /var/yp/Makefile


# line 119: add

ALL = passwd
shadow
group hosts rpc services netid protocols netgrp

root@master:~#
service portmap restart

portmap start/running, process 1403
root@master:~#
service nis restart

  * Stopping NIS services
    ...done.
  * Starting NIS services
    ...done.
root@master:~#
/usr/lib/yp/ypinit -m
# update NIS database


At this point, we have to construct a list of the hosts which will run NIS
servers. master is in the list of NIS server hosts. Please continue to add
the names for the other hosts, one per line. When you are done with the
list, type a <control D>.
    next host to add: master
    next host to add:
# push Ctrl + D key

The current list of NIS servers looks like this:

master

Is this correct? [y/n: y]
y

We need a few minutes to build the databases...
Building /var/yp/srv.world/ypservers...
gethostbyname(): Success
Running /var/yp/Makefile...
make[1]: Entering directory `/var/yp/srv.world'
Updating passwd.byname...
Updating passwd.byuid...
Updating shadow.byname...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating netgroup...
Updating netgroup.byhost...
Updating netgroup.byuser...
make[1]: Leaving directory `/var/yp/srv.world'

master has been set up as a NIS master server.

Now you can run ypinit -s master on all slave server.

# It's neccessary to update NIS database with following way if new user is added again

root@master:~#
cd /var/yp

root@master:/var/yp#
 
Tweet